package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RelationshipRecordMapper;
import com.ruoyi.system.domain.RelationshipRecord;
import com.ruoyi.system.service.IRelationshipRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 联系记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2019-10-16
 */
@Service
public class RelationshipRecordServiceImpl implements IRelationshipRecordService 
{
    @Autowired
    private RelationshipRecordMapper relationshipRecordMapper;

    /**
     * 查询联系记录
     * 
     * @param id 联系记录ID
     * @return 联系记录
     */
    @Override
    public RelationshipRecord selectRelationshipRecordById(Long id)
    {
        return relationshipRecordMapper.selectRelationshipRecordById(id);
    }

    /**
     * 查询联系记录列表
     * 
     * @param relationshipRecord 联系记录
     * @return 联系记录
     */
    @Override
    public List<RelationshipRecord> selectRelationshipRecordList(RelationshipRecord relationshipRecord)
    {
        return relationshipRecordMapper.selectRelationshipRecordList(relationshipRecord);
    }

    /**
     * 新增联系记录
     * 
     * @param relationshipRecord 联系记录
     * @return 结果
     */
    @Override
    public int insertRelationshipRecord(RelationshipRecord relationshipRecord)
    {
        relationshipRecord.setCreateTime(DateUtils.getNowDate());
        return relationshipRecordMapper.insertRelationshipRecord(relationshipRecord);
    }

    /**
     * 修改联系记录
     * 
     * @param relationshipRecord 联系记录
     * @return 结果
     */
    @Override
    public int updateRelationshipRecord(RelationshipRecord relationshipRecord)
    {
        relationshipRecord.setUpdateTime(DateUtils.getNowDate());
        return relationshipRecordMapper.updateRelationshipRecord(relationshipRecord);
    }

    /**
     * 删除联系记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteRelationshipRecordByIds(String ids)
    {
        return relationshipRecordMapper.deleteRelationshipRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除联系记录信息
     * 
     * @param id 联系记录ID
     * @return 结果
     */
    @Override
    public int deleteRelationshipRecordById(Long id)
    {
        return relationshipRecordMapper.deleteRelationshipRecordById(id);
    }
}
